Skip to content

feat: support microflow download file statement#333

Open
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/microflow-download-file-statement
Open

feat: support microflow download file statement#333
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/microflow-download-file-statement

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 27, 2026

Part of #332.

Summary

Adds MDL support for Studio Pro Microflows$DownloadFileAction using:

download file $GeneratedReport;
download file $GeneratedReport show in browser;

The statement preserves existing download-file actions during describe/exec/describe and makes the action authorable when the file document variable already exists.

Root Cause

DownloadFileAction was recognized by the MPR parser, but MDL had no AST node, grammar rule, visitor builder, describer output, graph builder, or writer support for it. Existing actions therefore could not round-trip as structured MDL.

Changes

  • Adds DownloadFileStmt to the microflow AST.
  • Adds download file $Var [show in browser] [on error ...] grammar and visitor support.
  • Formats/describes download-file actions as structured MDL.
  • Builds and writes real Microflows$DownloadFileAction objects with ErrorHandlingType, FileDocumentVariableName, and ShowInBrowser preserved.
  • Adds proposal docs, quick-reference entry, doctype fixture, and write-microflows skill guidance.

Validation

  • make build
  • go test ./mdl/visitor ./mdl/executor ./sdk/mpr -run 'TestDownloadFile|TestFormatAction_DownloadFile|TestBuildFlowGraph_DownloadFileCreatesRealAction'
  • ./bin/mxcli check mdl-examples/doctype-tests/download_file.test.mdl
  • make lint-go
  • make test
  • make test-integration

Agentic Code Testing

  • New syntax is documented in a proposal, quick reference, and synthetic doctype fixture.
  • Tests use synthetic module/microflow names only.
  • Roundtrip coverage verifies both MDL parsing/building and MPR serialization/parsing.

Symptom: describe/exec/describe could not preserve Studio Pro download-file activities because MDL had no statement for Microflows$DownloadFileAction.

Root cause: the action was parsed from MPR into the SDK model, but the AST, grammar, visitor, describer, builder, and writer did not expose it as authorable microflow syntax.

Fix: add `download file $FileDocument [show in browser]` with normal activity error handling, MPR read/write support, generated parser/completions, proposal docs, quick-reference coverage, and write-microflows skill guidance.

Tests: added parser/visitor, builder, formatter, and MPR roundtrip regressions, plus a synthetic doctype fixture. Validated with `make build`, focused Go tests, `mxcli check mdl-examples/doctype-tests/download_file.test.mdl`, `make lint-go`, `make test`, and `make test-integration`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants